package org.acegisecurity.util.expressioninterpreter;

/**
 * Interface representing an operator which van be applied to a value from the valueQueue.
 *
 * @author Jamie Craane
 * @author Ivo Woltring
 */
public interface Operator {
    /**
     * Checks if the principal has the required roles according according to the operator and the
     * values in the value {@link org.acegisecurity.util.expressioninterpreter.Stack}.
     *
     * @param roles      The roles the principle has.
     * @param valueStack The {@link org.acegisecurity.util.expressioninterpreter.Stack} containing the operands.
     * @return true when access is granted based on the roles the principal has and the operator, otherwise false.
     */
    public boolean apply(String[] roles, Stack valueStack);

    /**
     * Determines if this operator has greater precendece than the given operator.
     *
     * @param thisOp The operator to determine the precedence.
     * @return true if this operator has greater precedence than the given operator, false otherwise.
     */
    public boolean hasGreaterPrecedenceThan(Operator thisOp);
}
